package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易状态(0-待支付,1-支付成功，2-支付失败,3-处理中)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum OrderSettleBillTradeStateEnum {

    WAIT(0, "待支付"),
    SUCCESS(1, "支付成功"),
    FAIL(2, "支付失败"),
    PROCESSING(3, "处理中"),
    WAIT_HF_TRANSFER(4, "待汇付转账"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    OrderSettleBillTradeStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static OrderSettleBillTradeStateEnum typeOf(Integer value) {
        OrderSettleBillTradeStateEnum[] values = OrderSettleBillTradeStateEnum.values();
        for (OrderSettleBillTradeStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static OrderSettleBillTradeStateEnum typeOf(String name) {
        OrderSettleBillTradeStateEnum[] values = OrderSettleBillTradeStateEnum.values();
        for (OrderSettleBillTradeStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
